Skip to content

Refactor note graph dialog to use explicit canvas/details layout sizing#821

Merged
multiplex55 merged 2 commits intomasterfrom
codex/refactor-notegraphdialog-layout-management
Feb 11, 2026
Merged

Refactor note graph dialog to use explicit canvas/details layout sizing#821
multiplex55 merged 2 commits intomasterfrom
codex/refactor-notegraphdialog-layout-management

Conversation

@multiplex55
Copy link
Copy Markdown
Owner

Motivation

  • Make the graph canvas always act as the dynamic remainder area of the dialog and remove the implicit, nested available_width() sizing logic.
  • Centralize panel sizing constraints so layout is deterministic and testable when the details panel is toggled or the window is resized.

Description

  • Added centralized layout constants (MIN_CANVAS_WIDTH, DETAILS_WIDTH_RATIO, DETAILS_MIN, DETAILS_MAX, MIN_CANVAS_HEIGHT) and a pure helper fn compute_graph_layout(total_width: f32, details_visible: bool) -> (f32, Option<f32>) that returns (canvas_width, details_width) with clamping and minimum-enforcement logic.
  • Replaced implicit horizontal sizing in NoteGraphDialog::ui with a single computation from ui.available_width() and ui.available_height(), then explicitly allocated the canvas and optional details panel with allocate_ui_with_layout using the computed sizes so the canvas is the remainder area.
  • Updated main_canvas to accept a precomputed canvas_size: Vec2 and allocate exactly that size; adjusted right_panel to honor the exact allocated width.
  • Preserved existing rendering and interaction logic (camera zoom/pan, node hit-testing, selection, actions) while making panel sizing deterministic.

Testing

  • Ran cargo fmt -- src/gui/note_graph_dialog.rs which succeeded.
  • Added unit tests covering compute_graph_layout(...) (table-driven cases) and a regression test details_visible_canvas_only_shrinks_by_computed_details_width to assert canvas shrinkage equals the computed details width; tests are in src/gui/note_graph_dialog.rs test module.
  • Attempted to run cargo test compute_graph_layout, but test execution is blocked in this environment due to a Rust toolchain mismatch (rustc 1.87.0 vs a dependency requiring rustc 1.88.0).

Codex Task

@multiplex55 multiplex55 merged commit 18227f2 into master Feb 11, 2026
1 check passed
@multiplex55 multiplex55 deleted the codex/refactor-notegraphdialog-layout-management branch February 11, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant